home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
8614
/
8614.xpi
/
modules
/
application
/
Feedback.jsm
< prev
next >
Wrap
Text File
|
2010-02-10
|
2KB
|
71 lines
// DO NOT import this into the global namespace, but instead
// import it into your own namespace wrapper
var EXPORTED_SYMBOLS = ["Feedback"];
Components.utils.import("resource://glydo/utils/prototype_xul_1_6_0_3_modified.jsm");
Components.utils.import("resource://glydo/utils/Prefs.jsm");
Components.utils.import("resource://glydo/ClientInfo.jsm");
var Feedback = Prototype.Class.create({
initialize: function(rec) {
this.rec = rec;
},
send: function() {
var server_url = Prefs.server_url;
if (!server_url) {
return;
}
var params = {
action: "feedback",
clientId: CLIENT_INFO.clientId,
rec_set_id: this.rec.recSetId,
rec_id: this.rec.id,
};
if (Prefs.server_trace) {
params.useTrace = 1;
}
if (this.rec.feedback_details !== undefined && this.rec.feedback_details !== null) {
for (var d in this.rec.feedback_details) {
params["feedback_"+d] = this.rec.feedback_details[d];
}
}
if (this.rec.feedback_comment !== undefined && this.rec.feedback_comment !== null) {
params.feedback_comment = this.rec.feedback_comment;
}
// Create a new AJAX request for the feedback
var ajax_request = new Prototype.Ajax.Request(
server_url, {
method: 'post',
parameters: params,
onSuccess: Prototype.F.bind(this.onSendSuccess,this),
onFailure: Prototype.F.bind(this.onSendFailure,this)
});
},
onSendSuccess: function(response) {
if (!response || (response.status === 0)) {
this.onSendFailure(response);
return;
}
if ((response.status !== 200) || (response.responseText !== "")) {
return;
}
},
onSendFailure: function(response) {
var error = response ? response.responseText : "Communication problem";
if (!error) {
error = "Communication problem";
}
}
});